package org.example.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import org.example.domain.po.ErpLog;
import org.example.domain.po.ErpUser;
import org.example.domain.query.LogQuery;
import org.example.domain.vo.ErpLogVO;
import org.example.service.ErpLogService;
import org.example.utils.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("/log")
@RestController
public class ErpLogController {
    @Resource
    private ErpLogService erpLogService;
    
    @GetMapping("/page")
    @ApiOperation("日志分页查询")
    public Result<IPage<ErpLogVO>> queryLogIPage(@RequestAttribute ErpUser user, LogQuery logQuery) {
        logQuery.setTenantId(user.getTenantId());
        IPage<ErpLogVO> logIPage = erpLogService.queryLogPage(logQuery);
        return Result.success(logIPage);
    }
}
